package com.ssh.demo.netty.coder;

import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageEncoder;
import lombok.AllArgsConstructor;

import java.util.List;

/**
 * @ClassName TcpNettyEncoder
 * @Description TODO
 * @Author ssh
 * @Date 2021/4/12 11:53
 */
@AllArgsConstructor
public class TcpNettyEncoder extends MessageToMessageEncoder<byte[]> {


    @Override
    protected void encode(ChannelHandlerContext ctx, byte[] msg, List<Object> out) throws Exception {
        out.add(Unpooled.wrappedBuffer(msg));
    }
}
